<?php

namespace app\validate;

use think\Validate;

class Vali extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'email'                                        =>       'require|email',
        'phone|手机号'                           =>      'require|number|max:11|/^[18]{1}[3-9]{1}[0-9]{9}$/',
        'password|密码'                         =>      'alphaNum|require|length:6,10',
        'rePassword|确认密码'              =>      'confirm:password|require',
        'state|状态码'                             =>       'length:1|between:0,4',
        'username|用户名'                     =>        'require',
        'sex|性别'                                   =>        'require|number|length:1',
        'birthday'                                    =>        'require|number',
        'identity|身份'                              =>        'require|chs',
        'workplace|地区'                         =>        'require|chs',
        'userState|用户情况'                   =>        'chs|max:10',
        'ability|用户个人能力'                  =>       'max:50',
        'advantage|用户优势'                  =>       'max:50',
        'exp_jobtype|用户期待职位'         =>       'chs|max:20',
        'exp_job|用户期待工作'                =>       'max:10',
        'exp_moeny|用户期待薪资'          =>       'alphaNum|max:15',
        'exp_nature|用户期待工作性质'    =>       'chs|max:8',
        'company_name|用户实习公司'    =>       'require|max:20',
        'com_class|用户实习公司类型'     =>       'require|chs|max:10',
        'department|用户实习归属部门'    =>       'require|chs|max:10',
        'job|用户实习工作'                        =>       'require|max:25',
        'injob_time|用户在习开始'             =>       'require|number',
        'outjob_time|用户实习结束'           =>       'require|number|gt:injob_time',
        'project|用户经历项目'                  =>       'require|max:20',
        'pro_name|用户经历项目公司'      =>       'require|max:20',
        'mypro|用户经历项目部分'            =>       'require|max:20',
        'school|用户学校'                          =>       'require|chs|max:20',
        'level|用户学历'                             =>       'require|chs|max:5',
        'subject|用户专业'                         =>       'require|chs|max:10',
        'school_time|用户在校时间'           =>       'require|number|max:15',
        'out_school|用户离校时间'             =>       'require|number|max:15|gt:school_time',
        'in_school|用户在校经历'               =>       'require|max:20',
        'certificate|用户证书名'                   =>       'require|max:10',
        'mechanism|用户证书颁发机构'      =>       'require|max:10',
        'grade|用户证书等级'                      =>       'require|number|max:2',
        'is_check|用户证书是否可查'          =>       'require|chs|max:3',
        'official|职位'                                    =>       'require|max:20',
        'class|职位类型'                               =>         'require|max:15',
        'off_area|职位工作地址'                   =>         'require|max:30',
        'official_describe|职位描述'              =>         'require|max:50',
        'wordweek|职位周做几天'                =>         'require|number|max:8',
        'education|职位学历要求'                 =>         'require|max:8',
        'job_money|职位薪资'                       =>        'require|alphaDash|max:15',
        'company_logo'              =>      'require',
        'company_introduction|公司简介'   => 'require|length:5,300',
        'company_area|公司地址' => 'require|length:5,80',
        'company_welfare|公司福利'            => 'require|length:4,20',
        'range_money|公司薪资'         => 'require',
        'companyType|公司类型'           => 'require',
        'coproduct|产品名称'               => 'require',
        'product_introduction|产品简介'    => 'require|min:5|max:300',
        'company_addtime|公司创立时间'           =>  'require|number|length:10',
        'productType|产品标签'  =>  'require',
        'product_img|产品标志' =>  'require',
        'management|公司经营范围'          => 'require',
        'add_money|注册资本'              => 'require',
        'user_id|老板名称'                  =>'require',
        'com_official|职位数量' => 'require|number|min:1',
        'header|用户头像'          => 'require',
        'type|公司类型'     =>  'require|length:2,10',
        'user_id|用户id'    =>  'require',
        'official_id|职位id' => 'require',
        "worktime"          =>      'require|max:10',
        "requirement"          =>      'require|max:150',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */
    protected $message = [
        'phone'                            =>      '手机号不正确',
        'password.alphaNum'      =>  '密码为数字+字母格式',
        'password.length'            =>      '密码长度是6-10位',
        'state.between'                =>      '状态码是0-4之间',
        'state.length'                  =>      '状态码最大长度是1位',
        'companyLogo.fileMine'  =>'图片格式不正确',
        'companyLogo.fileSize' => '图片大小为5k以内',
        'company_introduction' => '公司简介为5-300个字',
        'com_official.min'  => '至少为1',
        ''=> ' ',
        'company_welfare.length'     =>         '长度超出限制',
        'product_introduction.length'   =>  '长度超出限制',
        'type.length'   =>  '长度超出限制'
    ];

    protected $scene = [
        'verifiCode'                =>               'phone',
        'passRegister'           =>               ['phone','password','rePassword'],
        'passLogin'                =>               ['phone','password'],
        'state'                         =>               'state',
        'editUserAttr'              =>               ['username','sex','identity','birthday','email','phone','workplace'],
        'editUserState'           =>               ['userState','ability','advantage','exp_jobtype','exp_job','exp_moeny','exp_nature'],
        'editTemp'                  =>               ['company_name','com_class','department','job','injob_time','outjob_time'],
        'editProject'                =>               ['project','pro_name','mypro'],
        'editStudy'                  =>               ['school','level','subject','school_time','out_school','in_school'],
        'editSSL'                     =>              ['certificate','mechanism','grade','is_check'],
        'securityPass'             =>              'password',
        'publicOff'                   =>              ['official','off_area','wordweek','education','job_money'],
        'offClass'                    =>              'class',
        'registerCompany' => ['company_introduction','company_name','company_area','company_welfare','range_money'],
        'companyType' => ['company_type'],
        'companyMassage' => ['add_money','management','company_time'],
        'Product'     => ['coproduct','product_introduction','producType'],
        'welfareChange'    =>  ['company_welfare'] ,
        'bossProduct'  => ['product_img','coproduct','product_introduction','productType'] ,
        'companyIntr' => ['company_name','com_official','company_introduction'],
        'typeCheck' => ['type'],
        'examChe'   =>  ['user_id','official_id']
    ];
}
